/*
* 公共变量、方法
* */

//公共IP
window.httpBase = 'http://192.168.0.98:8080';
//声明angular
window.myAppModule = angular.module('myApp', []);
window.myAppModule.run(function () {
    console.log('angular初始化');
});

//关闭弹窗
function closeLayer(index) {
    if (index >= 0) {
        layer.close(index);
    } else {
        layer.closeAll();
    }
};
//获取页面上的参数
var m_path = window.location.search;

//格式化URL参数
function formatUrl(path) {
    var urlParmas = {};
    var url = path.split('?')[1];
    var equalLength = url.split('=').length - 1;
    var andLength = url.split('&').length - 1;
    if (equalLength >= 2 && equalLength - andLength == 1) {
        var newUrl = url.split('&');
        for (var i = 0; i < newUrl.length; i++) {
            var item = newUrl[i].split('=');
            urlParmas[item[0]] = item[1];
        }
// console.log(urlParmas);
    } else {
        urlParmas[url.split('=')[0]] = url.split('=')[1];
// console.log(urlParmas);
    }
    return urlParmas;
}

if (m_path) {
    window.currentUrlParmas = formatUrl(m_path);
} else {
    window.currentUrlParmas = undefined;
}
